# test_cuda.py
import torch

print("PyTorch版本:", torch.__version__)
print("CUDA可用:", torch.cuda.is_available())
if torch.cuda.is_available():
    print("GPU数量:", torch.cuda.device_count())
    print("GPU型号:", torch.cuda.get_device_name(0))
    print("CUDA版本:", torch.version.cuda)

    # 测试GPU计算
    x = torch.tensor([1.0, 2.0]).cuda()
    y = torch.tensor([3.0, 4.0]).cuda()
    z = x + y
    print("GPU计算结果:", z)
# import torch
# print(torch.__version__)  # 应显示 2.6.0
# print(torch.cuda.is_available())  # 应显示 True